<?php
namespace app\agent\logic;

use app\common\model\UserPaydetalisAgentModel;

class UserPaydetalisAgentLogic extends UserPaydetalisAgentModel
{
	
	public function getPage($where = [], $request = [])
	{
		//排序
		$order = [
		    'status' => 'DESC',
            $this->getPk() => 'DESC',
		];

		//查询数据
		$data = $this->where($where)->order($order)->paginate(10, false, ['query' => $request]);

		//字段属性映射
		foreach ($data as $key => &$val)
		{
			$this->attributeMap($val);
		}
		
		return $data;
	}

	public function getDetail($where = [])
	{
		//查询数据
		$data = $this->where($where)->find();

		//字段属性映射
		$data = $this->attributeMap($data);

		return $data;
	}

    public function checkZhuanchu($request)
    {
        $where = [
            ['uid', '=', $request['uid']],
            ['oktime', '>', date('Y-m-d H:i:s', time()-86400)],
        ];

        return $this->where($where)->find();
	}
}